$(function () {
  //轮播图
  $.ajax({
    url: "http://localhost:8888/api/swipers",
    method: "get",
    success: function (data) {
      // console.log(data);
      $.each(data.data, (index, ele) => {
        var li = `<li><a href='javascript:;'><img src='http://localhost:8888/uploads/${ele.swiperimg}'/></a></li>`
        $("#kr_carousel ul").append(li)
      })
    },
  })
  layui.use("carousel", function () {
    // 轮播模块
    let carousel = layui.carousel
    // 轮播交互
    carousel.render({
      elem: "#kr_carousel",
      width: 720,
      height: 300,
      interval: 3000,
    })
  })
  $.ajax({
    url: "http://localhost:8888/api/links",
    method: "get",
    success: function (data) {
      console.log(data)
      $.each(data.data, (index, ele) => {
        var dd = `<dd><a href='${ele.linkurl}'><img src='http://localhost:8888/uploads/${ele.linkicon}'></a></dd>`
        $(".kr_collaborator dt").after(dd)
      })
    },
  })
})
